package com.example.db.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.example.db.entity.UserInfoEntity

@Dao
interface UserInfoDao {
    @Insert
    suspend fun insertUserInfo(vararg userInfo: UserInfoEntity) //varar关键字表示可以是多个参数

    @Delete
    suspend fun deleteUserInfo(vararg userInfo:UserInfoEntity)

    @Update
    suspend fun updateUserInfo(vararg userInfo: UserInfoEntity)

    @Query("select * from user_info_table order by userId")
    suspend fun queryAllUserInfo(): List<UserInfoEntity>

    @Query("select * from user_info_table where userId = :id")
    suspend fun queryUserInfoById(id: Int): UserInfoEntity

}